package com.ruoyi.backend.controller;

import com.ruoyi.backend.domain.ShopService;
import com.ruoyi.backend.service.IShopServiceService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 店铺服务Controller
 * 
 * @author wjr
 * @date 2025-09-23
 */
@RestController
@RequestMapping("/backend/t_shop_service")
@Api(tags = "店铺服务")
public class ShopServiceController extends BaseController
{
    @Autowired
    private IShopServiceService shopServiceService;

    /**
     * 查询店铺服务列表
     */
    @PreAuthorize("@ss.hasPermi('backend:t_shop_service:list')")
    @GetMapping("/list")
    @ApiOperation("查询店铺服务列表")
    public TableDataInfo list(ShopService shopService)
    {
        startPage();
        List<ShopService> list = shopServiceService.selectShopServiceList(shopService);
        return getDataTable(list);
    }

    /**
     * 获取店铺服务详细信息
     */
    @PreAuthorize("@ss.hasPermi('backend:t_shop_service:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取店铺服务详细信息")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(shopServiceService.selectShopServiceById(id));
    }

    /**
     * 新增店铺服务
     */
    @PreAuthorize("@ss.hasPermi('backend:t_shop_service:add')")
    @Log(title = "店铺服务", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增店铺服务")
    public AjaxResult add(@RequestBody ShopService shopService)
    {
        return toAjax(shopServiceService.insertShopService(shopService));
    }

    /**
     * 修改店铺服务
     */
    @PreAuthorize("@ss.hasPermi('backend:t_shop_service:edit')")
    @Log(title = "店铺服务", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改店铺服务")
    public AjaxResult edit(@RequestBody ShopService shopService)
    {
        return toAjax(shopServiceService.updateShopService(shopService));
    }

    /**
     * 删除店铺服务
     */
    @PreAuthorize("@ss.hasPermi('backend:t_shop_service:remove')")
    @Log(title = "店铺服务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    @ApiOperation("删除店铺服务")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(shopServiceService.deleteShopServiceByIds(ids));
    }

    /**
     * 导出店铺服务列表
     */
    /*@PreAuthorize("@ss.hasPermi('backend:t_shop_service:export')")
    @Log(title = "店铺服务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ShopService shopService)
    {
        List<ShopService> list = shopServiceService.selectShopServiceList(shopService);
        ExcelUtil<ShopService> util = new ExcelUtil<ShopService>(ShopService.class);
        util.exportExcel(response, list, "店铺服务数据");
    }*/

}
